<?php

class HCTime {
    
    /**
     * convert seconds to hour minute second
     * 
     * @param type $iSecond
     * @return type
     */
    
    public static function sencondsToTime($iSeconds) {
        $iSeconds = (int) $iSeconds;
        
        $iHour = floor($iSeconds/(60 * 60));
        
        $iDivision = $iSeconds % (60 * 60);
        
        $iMinute = floor($iDivision / 60);
        
        $iSecond = $iDivision % 60;
        
        $iMinute = str_pad($iMinute, 2, 0, STR_PAD_LEFT);
        return array($iHour, $iMinute, $iSecond);
    }
    
    public static function secondsToHour($iSeconds) {
        return floor($iSeconds/(60 * 60));
    }
    
    public static function secondsToMinute($iSeconds) {
        return floor($iSeconds / 60);
    }
    
    
    /**
     * Convert time to Seconds
     * 
     * @param type $iHour
     * @param type $iMinute
     * @param type $iSecond
     * @return type
     */
    public static function timeToSeconds($iHour = 0, $iMinute = 0, $iSecond = 0) {
        $iSeconds = (int) $iHour * 60 * 60 + (int) $iMinute * 60 + $iSecond;
        return $iSeconds;
    }
}
